import { Application } from 'egg';

export default (app: Application) => {
    const { STRING, CHAR, DATE, INTEGER } = app.Sequelize;
    const model = app.model.define('AssuageGrief', {
        assuage_grief_id: { type: CHAR(32), primaryKey: true },//主键id
        user_id: CHAR(32),//用户id
        topic_id: CHAR(32),//话题id
        assuage_grief_content: STRING(255),//解忧内容
        assuage_grief_picture: STRING(255),//解忧图片
        assuage_grief_time: DATE,//发布时间
        assuage_grief_praise: INTEGER(11),//点赞数
        assuage_grief_comment: INTEGER(11),//评论数
        assuage_grief_status: CHAR(1),//状态（1：正常，2：屏蔽）
        assuage_grief_anonymous: CHAR(1),//是否匿名（1是，2：否）
        created_by: CHAR(32),//创建人
        updated_by: CHAR(32),//更新人
        is_delete: CHAR(1),//是否删除（1：否，2：是）
    }, { tableName: 't_assuage_grief' });
    return model;
};

export class AssuageGrief {
    assuage_grief_id: string;
    user_id: string;
    topic_id: string;
    assuage_grief_content: string;
    assuage_grief_picture: string;
    assuage_grief_time: string;
    assuage_grief_praise: number;
    assuage_grief_comment: number;
    assuage_grief_status: string;
    assuage_grief_anonymous: string;
    created_by: string;
    updated_by: string;
    is_delete: string;
}